package com.ruoyi.hmy.service.impl;

import java.time.LocalDateTime;
import java.util.List;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.hmy.mapper.HmyCategoriesMapper;
import com.ruoyi.hmy.domain.HmyCategories;
import com.ruoyi.hmy.service.IHmyCategoriesService;

import javax.annotation.Resource;

/**
 * 店铺分类Service业务层处理
 *
 * @author ruoyi
 * @date 2023-04-14
 */
@Service
public class HmyCategoriesServiceImpl extends ServiceImpl<HmyCategoriesMapper,HmyCategories> implements IHmyCategoriesService {
    @Resource
    private HmyCategoriesMapper hmyCategoriesMapper;

    /**
     * 查询店铺分类
     *
     * @param id 店铺分类主键
     * @return 店铺分类
     */
    @Override
    public HmyCategories selectHmyCategoriesById(Long id) {
        return hmyCategoriesMapper.selectHmyCategoriesById(id);
    }

    /**
     * 查询店铺分类列表
     *
     * @param hmyCategories 店铺分类
     * @return 店铺分类
     */
    @Override
    public List<HmyCategories> selectHmyCategoriesList(HmyCategories hmyCategories) {
        return hmyCategoriesMapper.selectHmyCategoriesList(hmyCategories);
    }

    /**
     * 新增店铺分类
     *
     * @param hmyCategories 店铺分类
     * @return 结果
     */
    @Override
    public int insertHmyCategories(HmyCategories hmyCategories)
    {
        hmyCategories.setCreateTime(LocalDateTime.now());
        return hmyCategoriesMapper.insertHmyCategories(hmyCategories);
    }

    /**
     * 修改店铺分类
     *
     * @param hmyCategories 店铺分类
     * @return 结果
     */
    @Override
    public int updateHmyCategories(HmyCategories hmyCategories) {
        hmyCategories.setUpdateTime(LocalDateTime.now());
        return hmyCategoriesMapper.updateHmyCategories(hmyCategories);
    }

    /**
     * 批量删除店铺分类
     *
     * @param ids 需要删除的店铺分类主键
     * @return 结果
     */
    @Override
    public int deleteHmyCategoriesByIds(Long[] ids)
    {
        return hmyCategoriesMapper.deleteHmyCategoriesByIds(ids);
    }

    /**
     * 删除店铺分类信息
     *
     * @param id 店铺分类主键
     * @return 结果
     */
    @Override
    public int deleteHmyCategoriesById(Long id)
    {
        return hmyCategoriesMapper.deleteHmyCategoriesById(id);
    }
}
